const fs = require('fs')
const { success } = require('./output')

// 用来写文件的
module.exports = (path, data) => {
  return new Promise((resolve, reject) => {
    fs.writeFile(path, data, err => {
      err ? reject('文件写入错误！') : resolve(success('文件写入成功'))
    })
  })
}